package com.woniuxy.service;

import com.woniuxy.dto.CustomerApplicationDto;
import com.woniuxy.dto.CustomerApprovalDto;
import com.woniuxy.dto.CustomerProcessDto;
import com.woniuxy.entity.CustomerBasicInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

/**
 * 客户申请服务接口
 */
public interface CustomerApplicationService {

    /**
     * 创建客户申请
     */
    CustomerBasicInfo createCustomerApplication(CustomerApplicationDto applicationDto, String currentUser);

    /**
     * 更新客户申请
     */
    CustomerBasicInfo updateCustomerApplication(Long customerId, CustomerApplicationDto applicationDto, String currentUser);

    /**
     * 删除客户申请
     */
    void deleteCustomerApplication(Long customerId, String currentUser);

    /**
     * 根据ID获取客户申请
     */
    CustomerBasicInfo getCustomerApplicationById(Long customerId);

    /**
     * 根据ID获取客户详情（包含所有相关信息）
     */
    com.woniuxy.dto.CustomerDetailDto getCustomerDetailById(Long customerId);

    /**
     * 分页查询客户申请
     */
    Page<CustomerBasicInfo> getCustomerApplications(Pageable pageable, String customerName, String approvalStatus, String currentUser);

    /**
     * 获取用户的客户申请列表
     */
    List<CustomerBasicInfo> getUserCustomerApplications(String currentUser);

    /**
     * 获取待审批客户列表
     */
    List<CustomerBasicInfo> getPendingCustomerApplications(String currentUser);

    /**
     * 提交客户申请（启动工作流）
     */
    String submitCustomerApplication(Long customerId, String currentUser);

    /**
     * 审批客户
     */
    void approveCustomer(String processInstanceId, String currentUser);

    /**
     * 获取客户流程信息
     */
    CustomerProcessDto getCustomerProcess(Long customerId);

    /**
     * 获取客户流程步骤
     */
    List<CustomerProcessDto.ProcessStepDto> getCustomerProcessSteps(String processInstanceId);

    /**
     * 获取客户统计信息
     */
    Map<String, Object> getCustomerStatistics(String currentUser);

    /**
     * 取消客户申请
     */
    void cancelCustomerApplication(Long customerId, String reason, String currentUser);

    /**
     * 更新客户状态
     */
    void updateCustomerStatus(Long customerId, String status, String reason);

    /**
     * 处理流程回调
     */
    void handleProcessCallback(Map<String, Object> callbackData);

    void rejectCustomer(String processInstanceId, String reason, String currentUser);

    List<CustomerBasicInfo> queryByCreateBy(String createBy);

    List<CustomerBasicInfo> getHistoryCustomerApplications(String currentUser);
}
